﻿#include "mainwindowui.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    //建立唯一键
    QString strKey = "fr_key";
    LPCWSTR wstrKey = (LPCWSTR)strKey.toStdString().c_str();
    HANDLE hMutex = CreateMutex(NULL, FALSE, wstrKey);

    if(GetLastError() == ERROR_ALREADY_EXISTS){
        //实例存在
        if(hMutex){
            CloseHandle(hMutex);
            hMutex = NULL;
        }
        return -1;
    }

    MainWindowUI w;
    w.setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
    w.show();
    return a.exec();
}
